//
//  IHTabBarController.swift
//  InternetHospital
//
//  Created by Jekin on 2019/1/10.
//  Copyright © 2019 ZhuJiangChilink. All rights reserved.
//

import UIKit

final class IHTabBarController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        addChildControllers()
        
    }

    private func addChildControllers() {
        addChildViewController(UIViewController.init(), title: "首页", image: "home")
        addChildViewController(UIViewController.init(), title: "发现", image: "home")
        addChildViewController(UIViewController.init(), title: "视频", image: "home")
        addChildViewController(UIViewController.init(), title: "我的", image: "home")
        addChildViewController(IHTestViewController.init(), title: "测试", image: "home")
    }

    private func addChildViewController(_ childController: UIViewController,title:String,image:String) {
        childController.title = title
        childController.tabBarItem.image = getImage(imageName: image)
        childController.tabBarItem.selectedImage = getImage(imageName: "a")?.withRenderingMode(UIImageRenderingMode.alwaysOriginal)
//        childController.tabBarItem.setTitleTextAttributes([NSFontAttributeName: UIFont.systemFont(ofSize: 15),NSForegroundColorAttributeName: UIColor.orange], for: UIControlState.selected)
        let nav = IHNavController.init(rootViewController: childController)
        addChildViewController(nav)
    }
    
    
}

